﻿using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
using Zeus.Classes;

namespace Zeus.UserControls
{
    public partial class NewProjectChildWindow : ChildWindow
    {
        private List<XElement> Types{set;get;}
        public NewProjectChildWindow(List<XElement> list)
        {
            InitializeComponent();
            Types = new List<XElement>(list);
            _LB.ItemsSource = Types;
            _LB.DisplayMemberPath = "Value";
            
        }

        private void OkButtonClick(object sender, RoutedEventArgs e)
        {
            ProjectTypeEnum projType = ProjectTypeEnum.TowDimentions;
            AIType aiType = AIType.Action;
            if (_Rb2D.IsChecked == true)
            {
                projType = ProjectTypeEnum.TowDimentions;
            }
            
            if(_Rb3D.IsChecked == true)
            {
                projType = ProjectTypeEnum.ThreeDimentions;
            }
            switch (_LB.SelectedItem.ToString())
            {
                case "<type>empty project</type>":
                    aiType = AIType.Empty;
                    break;
                case "<type>Action Game</type>":
                    aiType = AIType.Action;
                    break;
                case "<type>Sport Game</type>":
                    aiType = AIType.Sports;
                    break;
                default:
                    break;
            }
            Project.NewProject(_TbProjectName.Text,projType,aiType);
            DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }
    }
}